var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var a in t) t.hasOwnProperty(a) && (e[a] = t[a]);
    })(e, t);
}, function(e, t) {
    function a() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (a.prototype = t.prototype, 
    new a());
}), a = this && this.__decorate || function(e, t, a, n) {
    var c, o = arguments.length, i = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, a, n); else for (var r = e.length - 1; 0 <= r; r--) (c = e[r]) && (i = (o < 3 ? c(i) : 3 < o ? c(t, a, i) : c(t, a)) || i);
    return 3 < o && i && Object.defineProperty(t, a, i), i;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("PetManager"), c = e("GameManager"), l = e("AudioManager"), d = e("GameConfig"), u = e("GameData"), p = e("EggsManager"), h = e("ActivityManager"), f = e("DataManager"), g = e("WebManager"), m = e("UIManager"), y = e("AdManager"), v = e("OlympicManager"), w = e("FSVideoAdManager"), b = e("VideoAdManager"), P = e("CustomAdManager"), I = cc._decorator, G = I.ccclass, _ = (I.property, 
function(e) {
    function t() {
        return null !== e && e.apply(this, arguments) || this;
    }
    return i(t, e), t.prototype.onLoad = function() {
        GA.Info.underCheck && d.GC.isDebug && (cc.sys.localStorage.clear(), r.G.init(), 
        u.GD.piece = 1e6, u.GD.diamond = 1e4, u.GD.isNew = 0, u.GD.olympicDrawTime = 1, 
        u.GD.gunIdx = 35, d.GC.eggConfig.forEach(function(e) {
            p.default.getInstance().eggConfigMap.set(e.idx, e);
        }), d.GC.eggPConfig.forEach(function(e) {
            p.default.getInstance().eggPConfigMap.set(e.idx, e);
        }), d.GC.eggCConfig.forEach(function(e) {
            p.default.getInstance().eggCConfigMap.set(e.idx, e);
        }), d.GC.activityConfig.forEach(function(e) {
            h.ActivityManager.getInstance().activityConfigMap.set(e.idx, e);
        }), this.testDraw()), -1 < u.GD.personIdx ? 0 == r.G.personModelList.filter(function(e) {
            return e.id == u.GD.personIdx;
        }).length && (u.GD.personIdx = 0) : 0 == r.G.eggPersonModelList.filter(function(e) {
            return e.id == 1 - u.GD.personIdx;
        }).length && (u.GD.personIdx = 0), y.default.getInstance().init(), b.default.getInstance().init(), 
        w.default.getInstance().init(), P.default.getInstance().init(), this.bind();
    }, t.prototype.start = function() {
        var e, t;
        null === (t = null === (e = GA.PA) || void 0 === e ? void 0 : e.onHide) || void 0 === t || t.call(e, function() {
            f.default.getInstance().save();
        }), this.schedule(function() {
            f.default.getInstance().save();
        }, 30), (GA.isWeChat() || GA.isQQ()) && f.default.getInstance().reqRank("wqycj"), 
        GA.isPlatform([ GA.Platform.OPPO, GA.Platform.QQ ]) && m.default.getInstance().loadPnl("privacyTips"), 
        d.GC.isVaild("sentAll") || g.default.getInstance().sentEvent({
            event_type: 0
        }), u.GD.isNew && (g.default.getInstance().sentLog("新增用户到达开始场景"), d.GC.isVaild("sentAll") && g.default.getInstance().sentEvent({
            event_type: 0
        }));
    }, t.prototype.bind = function() {
        var e, t = this;
        s.default.getInstance().isHas(1) || (0 == u.GD.hatchLastTime ? (cc.log("注册孵化事件"), 
        cc.systemEvent.on("hatch_reward", function(e) {
            t.doHatchReward(e);
        }), cc.systemEvent.on("hatch_timer", function() {
            cc.systemEvent.off("hatch_timer"), u.GD.hatchLastTime = Date.now(), f.default.getInstance().save(), 
            t.doHatchTimer(d.GC.hatchConfig.time);
        })) : (e = Math.floor((Date.now() - u.GD.hatchLastTime) / 1e3)) < d.GC.hatchConfig.time ? (cc.systemEvent.on("hatch_reward", function(e) {
            t.doHatchReward(e);
        }), this.doHatchTimer(d.GC.hatchConfig.time - e)) : this.doHatchReward());
    }, t.prototype.doHatchTimer = function(e) {
        cc.log("注册孵化定时器"), this.scheduleOnce(this.doHatchReward, e);
    }, t.prototype.doHatchReward = function(e) {
        var t;
        void 0 === e && (e = !0), c.default.getInstance().state != c.GameState.战斗中 && c.default.getInstance().state != c.GameState.战斗开始 && c.default.getInstance().state != c.GameState.战斗结束 && (cc.log("孵化成功事件"), 
        this.unschedule(this.doHatchReward), cc.systemEvent.off("hatch_reward"), cc.systemEvent.off("hatch_timer"), 
        s.default.getInstance().getRealData(1).has = 1, u.GD.petDataIdx = 1, f.default.getInstance().save(), 
        g.default.getInstance().sentLog("触发机甲暴龙孵化"), (t = m.default.getInstance().getPnl("start")) ? (t.petView.initPet(), 
        e && m.default.getInstance().loadPopPnl("reward", {
            type: r.RewardType.DRAGON,
            idx: 100
        })) : e && r.G.queue.push({
            name: "reward",
            type: 2,
            data: {
                type: r.RewardType.DRAGON,
                idx: 100,
                callback: function() {
                    var t = m.default.getInstance().getPnl("common");
                    t && (t.onClickBack = function() {
                        var e;
                        l.default.getInstance().playAudio("按钮2"), t.pushEvent("返回"), t.closePnl(), 0 < r.G.queue.length && (1 == (e = r.G.queue.shift()).type ? m.default.getInstance().loadPnl(e.name) : 2 == e.type && m.default.getInstance().loadPopPnl(e.name, e.data));
                    }, t.scheduleOnce(t.onClickBack, 6));
                }
            }
        }), cc.systemEvent.emit("hatch_show"), cc.systemEvent.emit("hatch_hide"), cc.systemEvent.emit("hatch_refresh"));
    }, t.prototype.testDraw = function() {
        for (var e = 0, t = 0, a = 0, n = 0, c = 0, o = 0, i = 0, r = 0; r < 20; r++) switch (v.default.getInstance().getDraw().type) {
          case 0:
            e++;
            break;

          case 1:
            t++;
            break;

          case 2:
            a++;
            break;

          case 3:
            n++;
            break;

          case 4:
            c++;
            break;

          case 5:
            o++;
            break;

          case 6:
            i++;
        }
        cc.warn("钻石:" + e + "，金币:" + t + "，皮肤:" + a + "，机器狗:" + n + "，武器:" + c + "，碎片:" + o + "，机器龙:" + i);
    }, a([ G ], t);
}(cc.Component));

n.default = _;